﻿package commands 
{
	import flash.utils.ByteArray;
	import commands.classesinfo.*;
	
	/**
	 * ...
	 * @author wwx
	 * 30000003 进入房间(返回)
	 */
	public class ExitRoomCmdReq extends abCommand
	{
		
		public function ExitRoomCmdReq() //: abCommand(CommandType.CMD_TYPE_EXITROOM_REQ) 
		{
			super(CommandType(CommandType.CMD_TYPE_EXITROOM_REQ));
			msgSeq = 10000004;
		}
		
		private var msgSeq:int;//消息号
		public var reserve:int;//保留字段	
		
		public function convertToBytes(bytes:ByteArray, offset:int):int
		{
/*			
			var len:int = 0;
			len += offset;
			bytes.position = offset;
			
			bytes.writeInt(msgSeq);
			len += 4;
			bytes.writeInt(reserve);
			len += 4;

			return len;
*/
		
			//bytes.writeInt(msgSeq);
			bytes[offset + 0] = (msgSeq & 0xff);
			bytes[offset + 1] = ((msgSeq >> 8) & 0xff);
			bytes[offset + 2] = ((msgSeq >> 16) & 0xff);
			bytes[offset + 3] = ((msgSeq >> 24) & 0xff);			
			offset += 4;
			
			//bytes.writeInt(reserve);
			bytes[offset + 0] = (reserve & 0xff);
			bytes[offset + 1] = ((reserve >> 8) & 0xff);
			bytes[offset + 2] = ((reserve >> 16) & 0xff);
			bytes[offset + 3] = ((reserve >> 24) & 0xff);				
			offset += 4;
			
			bytes.position = offset;
			bytes.length = offset;

			return offset;			
		}		
	}
	
}